import request from '@/config/axios'

// 邀请码 VO
export interface InvitationCodeVO {
  id: number // 主键id
  number: string // 检测卡号
  remainingNumber: number // 剩余检测次数
  numberDetections: number // 总检测次数
  effectiveDays: string // 有效天数
  status: string // 状态 待使用 已使用
}

// 邀请码 API
export const InvitationCodeApi = {
  // 查询邀请码分页
  getInvitationCodePage: async (params: any) => {
    return await request.get({ url: `/member/invitation-code/page`, params })
  },

  // 查询邀请码详情
  getInvitationCode: async (id: number) => {
    return await request.get({ url: `/member/invitation-code/get?id=` + id })
  },

  // 新增邀请码
  createInvitationCode: async (data: InvitationCodeVO) => {
    return await request.post({ url: `/member/invitation-code/create`, data })
  },

  // 修改邀请码
  updateInvitationCode: async (data: InvitationCodeVO) => {
    return await request.put({ url: `/member/invitation-code/update`, data })
  },

  // 删除邀请码
  deleteInvitationCode: async (id: number) => {
    return await request.delete({ url: `/member/invitation-code/delete?id=` + id })
  },

  // 导出邀请码 Excel
  exportInvitationCode: async (params) => {
    return await request.download({ url: `/member/invitation-code/export-excel`, params })
  }
}
